// pages/import/resource/resourceman.js
const app = getApp();
const domain = app.domain;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    item:null,
    appid:'',
    expiredate:'',
    resourceid:'',
    buylist:[]
  },
  getappid(e){
    this.setData({
      appid:e.detail.value
    })
  },
  submit(){
    wx.request({
      url: domain+'/app/resource',
      method:'POST',
      header:{
        "content-type": "application/x-www-form-urlencoded"
      },
      data:{
        appid:this.data.appid,
        expiredate:this.data.expiredate,
        resourceid:this.data.resourceid
      },
      success:res=>{
        console.log(res)
      }
    })
  },
  getexpiredate(e){
    this.setData({
      expiredate:e.detail.value
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  
  onLoad: function (options) {
    let resourceid  = options.resourceid;
    this.setData({
      resourceid
    })
    wx.request({
      url: domain+'/app/resource/'+resourceid,
      method:'GET',
      success:res=>{
        let rarr = res.data.data;
        console.log(rarr)
        this.setData({
          buylist:rarr
        })
      }
    })
    wx.request({
      url: domain+'/dict/resource/'+resourceid,
      method:'GET',
      success:res=>{
       // console.log(res)
        this.setData({
          item:res.data.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})